import { request } from './index';

export interface Account {
  name: string;
  password: string;
}

enum LoginAPI {
  AccountLogin = '/login',
  UserInfo = '/users/',
  UserMenus = '/role/'
}

// 调用测试
export function getTest(account: Account) {
  return request({
    url: LoginAPI.AccountLogin,
    method: 'post',
    data: { ...account }
  });
}

export function getUserById(id: number) {
  return request({
    url: LoginAPI.UserInfo + id,
    method: 'get'
  });
}

export function getUserMenus(id: number) {
  return request({
    url: LoginAPI.UserMenus + id + '/menu',
    method: 'get'
  });
}
